using System;
using System.Windows;
using System.Windows.Interop;

namespace SaturnExplorer
{
	public class ChromeWindow : Window
	{
		#region Hooks to show taskbar when maximizing customized WPF Window

		protected override void OnSourceInitialized(EventArgs e)
		{
			base.OnSourceInitialized(e);

			//This is required to show taskbar when maximizing customized WPF Window
			//http://blogs.msdn.com/b/llobo/archive/2006/08/01/maximizing-window-_2800_with-windowstyle_3d00_none_2900_-considering-taskbar.aspx
			IntPtr handle = (new System.Windows.Interop.WindowInteropHelper(this)).Handle;
			System.Windows.Interop.HwndSource.FromHwnd(handle).AddHook(WinInterop.WindowProc);

			//This hook fixes the problem with MinWidth and MinHeight when WindowStyle=None
			//http://stackoverflow.com/questions/1718666/how-to-enforce-minwidth-minheight-in-a-wpf-window-where-windowstyle-none
			HwndSource hwndSource = (HwndSource)HwndSource.FromVisual(this);
			WinInterop winInterop = new WinInterop(this);
			hwndSource.AddHook(winInterop.DragHook);
		}

		#endregion

	}
}